<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/api.js"></script>
</head>

<body>
    <div id="aui-slide">
        <div class="aui-slide-wrap">
            <div class="aui-slide-node bg-dark">
                <img src="image/l1.png" />
            </div>
            <div class="aui-slide-node bg-dark">
                <img src="image/l2.png" />
            </div>
            <div class="aui-slide-node bg-dark">
                <img src="image/l3.png" />
            </div>
        </div>
        <div class="aui-slide-page-wrap">
            <!--分页容器-->
        </div>
    </div>

    <ul class="index-nav">
        <li tapmode onclick="news_index(302,'安全保障')">
            <img src="image/index-nav-1.png" id='aqbz'>
            <p>安全保障</p>
        </li>
        <!-- <li tapmode onclick="xxpl()">
            <img src="image/index-nav-2.png">
            <p>信息披露</p>
        </li> -->
        <li tapmode onclick="xxpl_new()">
            <img src="image/index-nav-2.png" id='xxpl'>
            <p>信息披露</p>
        </li>
        <li>
            <img src="image/index-nav-3.png" tapmode onclick="integral_mall();" id='jfsc'>
            <p>积分商城</p>
        </li>
        <li onclick="kefu()">
            <img src="image/index-nav-4.png" id='khfw'>
            <p>客户服务</p>
        </li>
    </ul>

    <div class="index-1-t">
        新手体验
        <span>
            <img src="image/index-1.png">
            限量发售
        </span>
    </div>
    <dl class="index-1">
        <dd>预期年化收益</dd>
        <dt id="suiyixiang_rate"></dt>
        <span><img src="image/index-2.png">短期收益</span>
        <span><img src="image/index-3.png">本息返还</span>
        <span><img src="image/index-4.png">即时到账</span>
        <button type="button" tapmode onclick="syx_buy()">立即抢购</button>
        <p><img src="image/index-5.png">资金全程由鄂托克前旗农商行存管，安全有保障</p>
    </dl>
    <div class="index-2-t">
        新用户注册
        <span>送豪礼</span>
    </div>
    <ul class="index-2">
        <li>
            <div class="index-2-img">
                <img src="image/index-6.png" style="width:1.5rem;">
            </div>
            <dl tapmode onclick="news_region()">
                <dt>超值红包</dt>
                <dd>红包多多送不停，就等您来拿</dd>
                <button>立即抢购</button>
            </dl>
        </li>
        <!-- <li>
            <div class="index-2-img">
                <img src="image/index-7.png" style="margin-top:0.5rem">
            </div>
            <dl tapmode onclick="tiyanjin()">
                <dt>送10000元体验金</dt>
                <dd>利息全部带回家</dd>
                <button>立即抢购</button>
            </dl>
        </li> -->
    </ul>
    <div class="index-3">
        <p>平台累计交易额（元）</p>
        <h2 id="total_money"></h2>
        <span>市场有风险，出借需谨慎</span>
        <i></i>
    </div>

    <div class="kf-box-bg">
        <div class="kf-box">
            <div class="kf-box-t">
                <img src="image/kf-box.png">
                <dl>
                    <dt>400-0454-017</dt>
                    <dd>工作时间：8:30-17:30（工作日）</dd>
                </dl>
            </div>
            <button class="kf-box-btn-1" onclick="call_service()">拨打</button>
            <button class="kf-box-btn-2" onclick="kefuoff()">取消</button>
        </div>
    </div>

    <!-- 活动按钮 -->
<!--     <div class="index-hb" >
      <div class="index-hb-s">
          <i class="aui-iconfont aui-icon-close" onclick="closeimg()"></i>
          <img src="" alt="" onclick="wyhb()">
      </div>
  </div> -->

</body>
<script type="text/javascript" src="./script/aui-slide.js"></script>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript">
    function kefu() {
        $(".kf-box-bg").show();


    };

    function closeimg() {

      $('.index-hb').hide();

  }

  function kefuoff() {
    $(".kf-box-bg").hide()
};

function xxpl() {

    api.openWin({
        name: 'xxpl',
        url: './xxpl.html',
    });
}

function xxpl_new() {

    api.openWin({
        name: 'xxpl',
        url: './info-index.html',
    });
}

function unlock() {

}


var suiyixiang_id = '';
var urlArray = new Array();
var array = new Array();
var idarray = new Array();
apiready = function() {


   get_icon();
   var scrollShow = false;
   getScrollPicture();
        //轮播图显示
        ScrollPicture(scrollShow);
        load_suiyixiang_list();




        load_suiyixiang_list();
        totalData();
    }

    // 随意享部分数据
    function load_suiyixiang_list() {
        api.ajax({
            url: webAddress + '/index.php?ctl=app_deal&act=deal_list',
            method: 'get',
        }, function(ret, err) {
            if (ret) {
                // alert( JSON.stringify( ret ) );
                if (ret.status == 0) {
                    alert(ret.info);
                } else if (ret.status == 1) {
                    rate = ret.balance.list['0'].rate;
                    suiyixiang_id = ret.balance.list['0'].id;
                    $("#suiyixiang_rate").text(rate + "%");
                }
            }
        });

    }

    function syx_buy() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'syx_buy',
            url: './syx_buy.html',
            pageParam: {
                id: suiyixiang_id
            }
        });

    };

    function totalData() {
        api.ajax({
            url: 'http://www.big-wealth.com/index.php?ctl=app_deal2&act=deal_index',
            method: 'get',

        }, function(ret, err) {
            //交易金额
            var total_money = ret.total_money;
            $("#total_money").text(total_money);
        });

    }
    /*
        function updateSuiyixiangList(data, num) {

            var template = $api.byId('template');
            var dotFn = doT.template(template.innerHTML);
            var html = dotFn(data);
            var list = $api.byId('list');
            $api.html(list, html);
        }
        */
    //打开新闻页面

    function news_index(n, title) {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'news_index',
            url: './news_index.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            pageParam: {
                id: n,
                title: title
            }
        });
    }

    //打电话
    function call_service() {
        api.call({
            type: 'tel_prompt',
            number: '4000454017'
        });
    }



    //     // 顶部图片轮播
    //     var slide = new auiSlide({
    //         container: document.getElementById("aui-slide"),
    //         // "width":300,
    //         "height": 240,
    //         "speed": 500,
    //         "autoPlay": 3000, //自动播放
    //         "loop": true,
    //         "pageShow": true,
    //         "pageStyle": 'line',
    //         'dotPosition': 'center'
    //     })

    //轮播图ajax
    function getScrollPicture() {

        //ajax
        api.ajax({
            url: 'http://www.big-wealth.com/index.php?ctl=app_article&act=slide_index',
            method: 'post',
        }, function(ret, err) {
            if (ret) {
                var data = ret.slide;
                for (var i = 0; i < data.length; i++) {
                    array[i] = data[i].img.replace(/.\/public\/attachment/g, 'http://www.big-wealth.com/public/attachment');
                    urlArray[i] = data[i].data;
                }
            }
            test = urlArray;
            var scrollShow = true;
            ScrollPicture(array, data, urlArray, scrollShow);
        });

    }


    //轮播图
    function ScrollPicture(array, data, urlArray, scrollShow) {
        var UIScrollPicture = api.require('UIScrollPicture');
        if (!scrollShow) {
            UIScrollPicture.open({
                rect: {
                    x: 0,
                    y: 0,
                    w: api.winWidth,
                    h: api.winWidth / 2
                },
                data: {
                    paths: [
                    'widget://image/l1.png',
                    'widget://image/l2.png',
                    'widget://image/l3.png',
                    ],
                },
                styles: {
                    caption: {
                        height: api.winWidth / 2,
                        color: '#E0FFFF',
                        size: 13,
                        bgColor: '#696969',
                        position: 'bottom'
                    },
                    indicator: {
                        align: 'center',
                        color: '#FFFFFF',
                        activeColor: '#DA70D6'
                    }
                },
                placeholderImg: 'widget://image/l1.png',
                contentMode: 'scaleToFill',
                interval: 3,
                fixedOn: 'index',
                loop: true,
                fixed: false
            }, function(ret, err) {
                if (ret) {

                    // if (ret.eventType == 'click' && test) {
                    //     api.openWin({
                    //         name: 'web',
                    //         url: './web-url.html',
                    //         pageParam: {
                    //             url: test[ret.index]
                    //         }
                    //     });
                    // }

                }
            });
        } else {
            UIScrollPicture.reloadData({
                data: {
                    paths: array,
                }
            });
        };
        //修改尺寸
        var a = api.winWidth / 2;
        $('.index-nav').css('margin-top', a + 10);
    };

    //

    // 新手专区
    function news_region() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'news_region',
            url: './news-region.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    function get_icon() {
      api.ajax({
          url: 'http://www.big-wealth.com/index.php?ctl=app_article&act=images',
          method: 'post',
      },function(ret, err){
          if (ret) {
            var data = ret.fl;

            for (var i = 0; i < data.length; i++) {
              if (data[i].name=='安全保障') {
                $('#aqbz').attr("src", data[i].address);
            }else if (data[i].name=='积分商城') {
                $('#jfsc').attr("src", data[i].address);
            }else if (data[i].name=='客户服务') {
                $('#khfw').attr("src", data[i].address);

            }else if (data[i].name=='信息披露') {
                $('#xxpl').attr("src", data[i].address);
            }

            if (data[i].name=='万元红包') {
                if (data[i].is_show == 1) {
                  $('.index-hb').show();
                  $('.index-hb img').attr('src',data[i].address);

              }


          }


      }

  } else {
      alert( JSON.stringify( err ) );
  }
});

  }

  function wyhb() {
      var delay = 0;
      if (api.systemType != 'ios') {
          // delay = 300;
      }

      var userid = $api.getStorage('userid');
      if (!userid) {
          alert('请先登录');
          api.openWin({
              name: 'login',
              url: './login.html',
              pageParam: {
                  name: 'test'
              }
          });
          return false;
      }

      // api.openWin({
      //     name: 'red_packet_list',
      //     url: './red-packet-list.html',
      //     bounces: false,
      //     delay: delay,
      //     slidBackEnabled: true,
      //     vScrollBarEnabled: false,
      //     progress: {
      //         type: "page"
      //     }
      // });
      api.openWin({
          name: 'lphd',
          url: './roulettedraw.html',
      });

  }


  function tiyanjin() {
    var delay = 0;
    if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openWin({
            name: 'tiyanjin',
            url: './tiyanjin.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    };

    // 积分商城
    function integral_mall() {
        var delay = 0;
        if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
            alert('请先登录');
            api.openWin({
                name: 'login',
                url: './login.html',
                pageParam: {
                    name: 'test'
                }
            });
            return false;
        }


        api.openWin({
            name: 'integral',
            url: './integral.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            progress: {
                type: "page"
            }
        });
    }
</script>

</html>
